<template>
  <div class="child">
    <h3>子组件2</h3>
    <h4>电脑:{{ computer }}</h4>
    <h4>书籍:{{ book }}本</h4>
    <button @click="minusHouse($parent)">干掉父亲一套房产</button>
  </div>
</template>

<script setup lang="ts">
import { ref } from "vue";
//数据
let computer = ref("神威·太湖之光");
let book = ref(114514);
//把数据交给外部
defineExpose({ computer, book });
function minusHouse(parent: any) {
  console.log(parent);
  parent.house--;
}
</script>

<style scoped>
.child {
  background: rgb(231, 190, 112);
  padding: 10px;
  box-shadow: 0 0 10px black;
  border-radius: 10px;
}
</style>
